package com.hongyang.service.impl;

import com.hongyang.entity.Hospital;
import com.hongyang.mapper.HospitalMapper;
import com.hongyang.service.HospitalService;
import com.hongyang.util.MybatisUtil;
import org.apache.ibatis.session.SqlSession;

import java.util.ArrayList;
import java.util.List;

public class HospitalServiceImpl implements HospitalService {
    @Override
    public List<Hospital> search() {
        List<Hospital> list=new ArrayList<>();
        try (SqlSession session= MybatisUtil.getSqlSessionFactory().openSession()){
            HospitalMapper mapper = session.getMapper(HospitalMapper.class);
            list=mapper.search();
        }
        return list;
    }
}
